<div class="top bar">
  <div class="left">
    <ul class="inline-list">
      <li><%= link_to 'Chemist Pro', root_path %></li>
      <% if !current_user.nil? %>
      <li>系统公告</li>
      <li>使用说明</li>
      <% end %>
    </ul>
  </div>
  <div class="right">
    <ul class="inline-list">
    <% if current_user.nil? %>
      <li>请登录</li>
    <% else %>
      <li>
        <%= image_tag current_user.avatar_url, width: 20, height: 20,
          style: 'position:relative;top:4px' %>
        <%= current_user.name_display %>
      </li>
      <li><%= link_to '账户', users_me_path %></li>
      <li>通知</li>
    <% end %>
    </ul>
  </div>
</div>
<% if !@competition.nil? %>
<div class="competition bar">
  <div class="left">
    <h1><%= link_to @competition.name, @competition %></h1>
  </div>
  <div class="right">
    <div class="search">
      <%= form_tag search_competition_path(@competition), method: 'get' do %>
        <%= text_field_tag :wd, '', autocomplete: 'off', spellcheck: 'false',
          onfocus: "if(this.value=='搜索') {this.value='';this.style.color='#000'}",
          onblur:  "if(this.value=='') {this.value='搜索';this.style.color='#777'}",
          value: '搜索', style: 'color:#777', 'class' => 'single_line'
         %>
      <% end %>
    </div>
  </div>
</div>
<% end %>
<% if !@competition.nil? %>
  <div class="bar">
    <ul class="tab_bar">
      <%= tab_tag '概览', nil %>
      <%= tab_tag '题目', 'question_lists' %>
      <%= tab_tag '讨论', 'topics' %>
      <%= tab_tag '任务', 'tasks' %>
    </ul>
  </div>
<% end %>